#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
/*
 * Zenlayer.com Inc.
 * Copyright (c) 2014-2021 All Rights Reserved.
 */
package ${package}.${artifactId}.config.amqp.callback;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.${artifactId}.ReturnedMessage;
import org.springframework.amqp.rabbit.${artifactId}.RabbitTemplate;

/**
 * @author wangjunjie
 * @version ${symbol_dollar} Id: RabbitReturnCallback.java, v 0.1  wangjunjie Exp ${symbol_dollar}
 * @date 2019-09-18 15:10:02
 */
public class RabbitReturnCallback implements RabbitTemplate.ReturnsCallback {

    private static final Logger logger = LoggerFactory.getLogger(RabbitReturnCallback.class);


    @Override
    public void returnedMessage(ReturnedMessage returnedMessage) {
        logger.error("message:" + returnedMessage.getMessage() + ",replyCode:" + returnedMessage.getReplyCode() + ",replyText:" + returnedMessage.getReplyText() + ",exchange:" + returnedMessage.getExchange() + ",routingKey:"
                + returnedMessage.getRoutingKey());
        logger.error("消息从交换机发送到队列时失败的回调函数, 调用失败！！！{}", returnedMessage);
    }
}
